﻿// Doc-Encode UTF8-BOM, Space(4), Unix(LF)
#include "hiobj_help.h"
#include <string.h>
#include <assert.h>


void cmap_get_HI_S64(klb::CMap& r, const std::string& key, HI_S64* p_s64)
{
    assert(NULL != p_s64);

    int64_t v = 0;
    if (r.Get(key, v))
    {
        *p_s64 = (HI_S64)v;
    }
}

void cmap_get_HI_U64(klb::CMap& r, const std::string& key, HI_U64* p_u64)
{
    assert(NULL != p_u64);

    int64_t v = 0;
    if (r.Get(key, v))
    {
        *p_u64 = (HI_U64)v;
    }
}

void cmap_get_HI_S32(klb::CMap& r, const std::string& key, HI_S32* p_s32)
{
    assert(NULL != p_s32);

    int64_t v = 0;
    if (r.Get(key, v))
    {
        *p_s32 = (HI_S32)v;
    }
}

void cmap_get_HI_U32(klb::CMap& r, const std::string& key, HI_U32* p_u32)
{
    assert(NULL != p_u32);

    int64_t v = 0;
    if (r.Get(key, v))
    {
        *p_u32 = (HI_U32)v;
    }
}

void cmap_get_HI_CHAR(klb::CMap& r, const std::string& key, HI_CHAR* p_char, int size)
{
    assert(NULL != p_char);

    std::string s;
    if (r.Get(key, s))
    {
        strncpy(p_char, s.c_str(), size - 1);
    }
}
